package com.wonders.ssm.constant;

import com.wonders.ssm.common.CommonResult;

/**
 * 消息提示
 * Created by lv on 2018/8/9.
 */
public class Message {
    public final static String SUCCESS_MESSAGE = "success";
    public final static String ERROR_MESSAGE = "error";
    public final static String NULL_MESSAGE = "null";
    public final static String ERROR_IMAGECODE_MESSAGE = "验证码错误";


    public final static int SUCCESS_CODE= 200;
    public final static int ERROR_CODE = 500;
    public final static int NULL_CODE = 204;
    public final static int ERROR_IMAGECODE = 203;

    /**
     * 空消息设置
     * @param result
     */
    public static void setNullMessage(CommonResult result){
        result.setCode(NULL_CODE);
        result.setMessage(NULL_MESSAGE);
    }

    /**
     * 错误消息设置
     * @param result
     */
    public static void setErrorMessage(CommonResult result,String message){
        result.setCode(ERROR_CODE);
        result.setMessage(ERROR_MESSAGE + "\t:"+message);
    }

    public static void setImageCodeMessage(CommonResult result){
        result.setCode(ERROR_IMAGECODE);
        result.setMessage(ERROR_IMAGECODE_MESSAGE);
    }

}
